package com.type;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;

public class Activity extends Photo {
	String title;
	String content;
	ArrayList<Long> followerNumList = new ArrayList<Long>();;
	ArrayList<Follower> followList = new ArrayList<Follower>();

	
	public Activity() {
		super();
	}
	
	public ArrayList<Follower> getFollowList() {
		return followList;
	}

	@Override
	public void send(DataOutputStream dos) throws IOException, InterruptedException {
		super.send(dos);
		dos.writeUTF(title);
		dos.writeUTF(content);
		
		if(followerNumList == null)
			dos.writeInt(0);
		else {
			dos.writeInt(followerNumList.size());
			for(Long followerNum : followerNumList)
				dos.writeLong(followerNum.longValue());
		}
	}

	@Override
	public void receive(DataInputStream dis) throws IOException, InterruptedException {
		super.receive(dis);
		title = dis.readUTF();
		content = dis.readUTF();
		
		int size = dis.readInt();
		if(size > 0) {
			followerNumList.clear();
			for(int i=0; i<size; i++)
				followerNumList.add(new Long(dis.readLong()));
		}
	}
}
